from apps.commom.package import VipPackageSerializer
from apps.schemas import R
from models.models import VipPackage
from utils.auth import AppletAuthBearer
from ninja import Router
from utils.decorators import handle_exception

applet_vip_package_router = Router(tags=["前端商品"], auth=AppletAuthBearer())


@applet_vip_package_router.get("vip_package", summary="获取会员套餐")
@handle_exception("获取会员套餐失败")
def get_vip_package(request):
    vip_package = VipPackage.objects.all()
    vip_package_serializer = VipPackageSerializer(vip_package, many=True)
    return R.ok(data=vip_package_serializer.data)
